package com.financing.wap.service.impl;

import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.financing.wap.dao.IYouDanAmountDetailDao;
import com.financing.wap.dto.FpYouDanAmountDetailDTO;
import com.financing.wap.service.IYouDanAmountDetailService;

@Service("youDanAmountDetailServiceImpl")
public class YouDanAmountDetailServiceImpl implements
		IYouDanAmountDetailService {

	@Autowired
	private IYouDanAmountDetailDao youDanAmountDetaiDaolImpl;

	@Override
	public int insertYouDanAmountDetail(
			FpYouDanAmountDetailDTO youDanAmountDetailDTO) throws SQLException {
		return youDanAmountDetaiDaolImpl
				.insertYouDanAmountDetail(youDanAmountDetailDTO);
	}

	@Override
	public List<FpYouDanAmountDetailDTO> queryYouDanAmountDetailList(
			FpYouDanAmountDetailDTO youDanAmountDetailDTO) throws SQLException {
		return youDanAmountDetaiDaolImpl
				.queryYouDanAmountDetailList(youDanAmountDetailDTO);
	}

	@Override
	public void updateYouDanAmountDetail(
			FpYouDanAmountDetailDTO youDanAmountDetailDTO) throws SQLException {
		youDanAmountDetaiDaolImpl
				.updateYouDanAmountDetail(youDanAmountDetailDTO);

	}

	@Override
	public FpYouDanAmountDetailDTO queryYouDanAmountDetailById(Integer id)
			throws SQLException {
		FpYouDanAmountDetailDTO bean = new FpYouDanAmountDetailDTO();
		bean.setId(id);

		List<FpYouDanAmountDetailDTO> list = youDanAmountDetaiDaolImpl
				.queryYouDanAmountDetailList(bean);
		if (list != null && list.size() > 0) {
			return list.get(0);
		}
		return null;
	}

}
